import React from 'react'
import styles from './index.module.css'
import request from "../../../utils/request";
import {Radio, List} from 'antd-mobile'
import yeImg from '../../../assets/golive/pic_ye.png'
import Nav from '../../../components/nav'

const RadioItem = Radio.RadioItem;

class Index extends React.Component {

    pay = () => {
        request('/order/ali-pay').then((result) => {
            const {payURL} = result.data;
            console.log(result);
            window.location.href = payURL;
        }).catch(() => {

        });
    };

    render() {
        return (
            <div className={styles.container}>
                <Nav/>
                <div className={styles.summary}>
                    <span className={styles.time}>支付剩余时间 14:55</span>
                    <b style={{
                        fontSize: '26px'
                    }}>¥20.40</b>
                    <span className={styles.product}>福气陶瓷杯淡青色天下第一 订单详情</span>
                </div>

                <List>
                    <RadioItem onChange={() => {
                    }} checked={true}>
                        <img src={yeImg} alt="" style={{width: '22px'}}/>
                        <span style={{paddingLeft: '10px'}}>支付宝支付</span>
                    </RadioItem>
                </List>

                <div className={styles.bottom}>
                    <button onClick={this.pay} className={styles.payBtn}>支付</button>
                </div>
            </div>
        );
    }
}

export default Index
